package com.example.smartcity_poverty.ui.SmartSubject.AllSubjectActivity.PovertyActivity.fragment.poverty.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MenuItem
import com.example.smartcity_poverty.R
import com.example.smartcity_poverty.logic.util.Util.show
import com.example.smartcity_poverty.ui.SmartSubject.AllSubjectActivity.PovertyActivity.fragment.poverty.activity.MoreFourActivity.Companion.FourData
import com.example.smartcity_poverty.ui.SmartSubject.AllSubjectActivity.PovertyActivity.fragment.poverty.model.PtFourEntity
import kotlinx.android.synthetic.main.activity_add_four_list.*

/**
 * Activity
 */
class AddFourListActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        supportActionBar?.setDisplayHomeAsUpEnabled(true)
        setContentView(R.layout.activity_add_four_list)
        title = "案例发布"

        edOk.setOnClickListener {
            if (ed1.text.toString().isEmpty() && ed12.text.toString().isEmpty()) "不能为空！".show()
            else {
                FourData.add(PtFourEntity(R.mipmap.c1, ed1.text.toString(), ed12.text.toString()))
                finish()
            }
        }

    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        finish()
        return super.onOptionsItemSelected(item)
    }
}